﻿using AutoMapper;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using System;

namespace SmarterCharger.Library.Tests.Unit.Infrastructure
{
    public static class AutoMapperConfigurationTest
    {
        public static void Verify(Action createMaps)
        {
            // Arrange
            string mappingError = null;
            createMaps();

            // Act
            try
            {
                Mapper.AssertConfigurationIsValid();
            }
            catch (AutoMapperConfigurationException ex)
            {
                mappingError = ex.Message;
            }

            // Assert
            Assert.IsNull(mappingError, mappingError);
        }
    }
}
